﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Husb.Framework;
using Husb.Framework.DataAccess;


namespace Crawler.Model
{
    [Serializable]
    public class TaskCategoryInfo : EntityBase
    {
        #region Private Variables
        private System.Guid id;
        private System.String name;
        private System.Guid? parentId;
        #endregion

        #region Properties
        /// <summary>
        /// 
        /// </summary>		
        public System.Guid Id
        {
            get { return id; }
            set { id = value; }
        }
        /// <summary>
        /// 
        /// </summary>		
        public System.String Name
        {
            get { return name; }
            set { name = value; }
        }
        /// <summary>
        /// 
        /// </summary>		
        public System.Guid? ParentId
        {
            get { return parentId; }
            set { parentId = value; }
        }
        #endregion

        #region GenerateFilterExpression
        /// <summary>
        /// 产生组合查询的条件
        /// </summary>
        /// <param name="taskCategory">当前实体类<see cref="TaskCategoryInfo"/>TaskCategoryInfo</param>
        /// <returns></returns>
        public override string FilterExpression
        {
            get
            {
                string where = "";
                where += DataAccessHelper.GetPartWhereCondition("Id", Id);
                where += DataAccessHelper.GetPartWhereCondition("Name", Name);
                where += DataAccessHelper.GetPartWhereCondition("ParentId", ParentId);

                return where;
            }
        }
        #endregion

        #region Validate
        /// <summary>
        /// 数据验证
        /// </summary> 
        protected override void Validate()
        {
            //AddRule("Price", "Price must be greater than or equal to 0", this.Price < 0);
            //AddRule("Name", "Name must be set", string.IsNullOrEmpty(this.Name));
        }
        #endregion

    }
}
